import dotenv from 'dotenv'
dotenv.config()
import Koa from 'koa'
import db from "./db";
db()
import koaViews from 'koa-views'
import router from './routers';
import koaBody from "koa-body";

const app = new Koa()

export default function run (){
    app.use(koaBody({
        multipart: true,
        formidable: {
            maxFieldsSize: 200 * 1024 * 1024
        }
    }))
    app.use(koaViews('src/views', { extension: 'ejs'}))
    app.use(router.routes())
    app.listen(process.env.SERVER_PORT)
}